<?php
namespace app\controller;

use app\service\ArticleService;
use think\facade\View;
use think\facade\Request;
class Index extends Base
{
    public function index()
    {
        // 模板变量赋值
        $ArticelService = new ArticleService();
        $page =  Request::param('page',0);
        $size =  20;
        $list = $ArticelService->getList($page,$size);
        View::assign('next_page',$page+1);
        if($page==0){
            View::assign('prepage',$page);
        }else{
            View::assign('prepage',$page-1);
        }
        View::assign('list',$list);
        // 模板输出
        return View::fetch('index');
  }


}
